#!/bin/csh -f

set APP_NAME="T-Vox 1.0 Hot Mix Demo"
set PGM_NAME=hm_TVox
set INST_DIR=HotMixTVox
set INST_PATH=/usr/tmp/$INST_DIR
set KBYTES_REQ=8500

if ( $KBYTES_REQ < 1000 ) then
        set MBYTES_REQ=1
else
        @ MBYTES_REQ = ($KBYTES_REQ) / 1000
endif
set KBYTES_AVAIL=`df -k /usr | tail -1 | /usr/bin/awk '{print $5}'`
set KL=`hinv -c graphics | awk 'BEGIN {ORS=" "} {print} END {ORS="\n"; print ""}'`

echo $KL
echo "The demo requires $MBYTES_REQ Mbytes of disk space."
echo " "

if ( $KBYTES_AVAIL > $KBYTES_REQ ) then

	# check graphics board

	switch ( "$KL" )
		case *InfiniteReality*:
			breaksw
		case *Impact*:
			breaksw
		case *CRM*|*RealityEngine*|*Extreme*:
			echo T-Vox DEMO only runs on either
			echo an Impact, Octane or Onyx2 InfiniteReality
			echo hit any key to terminate installation ...
			set waitans=($<)
			exit
		default:
			# assume Octane
		echo "Unrecognized platform."
		echo "Octane users can still run the demo."
			breaksw
	endsw

        echo "It will be installed in a directory named $INST_PATH."
        echo "Continue with installation (y/n)?  \c"
        set ans=($<)
        if ( $ans != 'y' ) then
                echo " "
                echo "... Bye."
                sleep 2
                exit
        endif

	echo " "
	echo "Installation in progress....."

        #echo " "
        #echo "At the 'Inst>' prompt, type 'go' and press 'enter'."
        #echo "When installation is complete, type 'quit' and press 'enter'."
        #echo " "

        inst -a -f instImage > /dev/null
        if ( `versions | grep HotMixTVox | wc -l` > 0 ) then
cp $HOTMIXDIR/html/vendors/htmedical/demos/hm_TVox /usr/tmp/HotMixTVox
                echo " "
                echo "Installation is completed."
		echo " "
                echo "Do you want to run the demo now (y/n)?  \c"
                set ans=($<)
                if ( $ans == 'y') then
                        cd $INST_PATH
                        exec $INST_PATH/$PGM_NAME
                        echo "Could not execute $INST_PATH/$PGM_NAME."
                        exit
                endif
                echo " "
                echo "To run the demo from the command line, move to the"
		echo "$INST_PATH directory and execute $PGM_NAME."
        else
                echo " "
                echo $APP_NAME " was not installed properly,"
                echo "please try again."
                echo " "
        endif
else
        echo "There is not enough disk space available to install the demo."
endif

echo " "
echo "Press Enter to exit this window...  \c"
set ans=($<)

